import { Spin } from "antd";
import type { PropsWithChildren } from "react";

type LoadingProps = PropsWithChildren<{
  loading: boolean;
}>;
export default function Loading(props: LoadingProps) {
  const { loading, children } = props;

  if (loading) {
    return (
      <Spin spinning>
        <div className="h-20" />
      </Spin>
    );
  }

  return children;
}
